package com.yuantu.judiciary.model.api;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yuantu.judiciary.model.enums.SearchType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * 限制高消费查询参数表单
 * <p>
 * 查询个人时，id、name 为必传参数。
 * 查询企业时，creditCode、name 二者至少传一个， 若两个参数都传则以 creditCode 为准
 * <./p>
 * @author syw
 * @since 2023-06-29
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("限制高消费查询参数表单")
public class LimitHighDTO {
    @ApiModelProperty("自然人时必须传身份证号，企业时为空")
    private String id;
    @ApiModelProperty("自然人姓名或企业名称")
    private String name;
    @ApiModelProperty("企业社会统一信用代码，自然人时为空")
    private String creditCode;
    @ApiModelProperty("授权标识，1 已授权，0 未授权")
    @NotNull(message = "授权标识不能为空")
    private Integer authorize;
    @JsonIgnore
    private SearchType type;

    public LimitHighDTO(String name, Integer authorize) {
        this.name = name;
        this.authorize = authorize;
        this.type = SearchType.ENTERPRISE;
    }

    public LimitHighDTO(String id, String name, Integer authorize) {
        this.id = id;
        this.name = name;
        this.authorize = authorize;
        this.type = SearchType.PERSON;
    }
}
